package com.example.pickupclosefirstdemo.main;

import android.view.View;

import androidx.databinding.BaseObservable;
import androidx.databinding.Bindable;
import androidx.databinding.library.baseAdapters.BR;

import com.example.pickupclosefirstdemo.R;

public class User extends BaseObservable {

    private String userName;
    private String userAge;

    public User(String userName,String userAge){
        this.userName = userName;
        this.userAge  = userAge;
    }

    @Bindable
    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
        notifyPropertyChanged(BR.userName);
    }

    @Bindable
    public String getUserAge() {
        return userAge;
    }

    public void setUserAge(String userAge) {
        this.userAge = userAge;
        notifyPropertyChanged(BR.userAge);
    }

    public void command(View view){
        switch (view.getId()){
            case R.id.btnModuleAdd:
                setUserName("莉莉");
                break;
            case R.id.btnModuleDelete:
                setUserName("CC");
                break;
            default:
        }
    }
}
